﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace YellowMap.View.Control
{
    public partial class WhiteNodePin : UserControl
    {
        public class WhiteNodePinData 
        {
            public double Lattitude { get; set; }
            public double Longitude { get; set; }
            public int Number { get; set; }
        
        }

        public WhiteNodePin()
        {
            
            InitializeComponent();
            Data = new WhiteNodePinData();
        }

        public void UpdateUI()
        {
            txtNumber.Text = _Data.Number.ToString();
        }

        WhiteNodePinData _Data;
        public WhiteNodePinData Data 
        {
            get
            {
                return _Data;
            }
            set
            {
                _Data = value;
                txtNumber.Text = _Data.Number.ToString();
            }
        }

        public void ChangeToNormalState()
        {
            if (IsStartEndPoint)
            {
                return;
            }
            VisualStateManager.GoToState(this, "normal", true);
        }

        public void ChangeToSelectedState()
        {
            if (IsStartEndPoint)
            {
                return;
            }
            VisualStateManager.GoToState(this, "selected", true);
        }


        public bool IsStartEndPoint = false;
      

        public void ChangeToRedState()
        {
            IsStartEndPoint = true;
            VisualStateManager.GoToState(this, "red", true);
        }

        public void ChangeToGreenState()
        {
            IsStartEndPoint = true;
            VisualStateManager.GoToState(this, "green", true);
        }
    }
}
